<template>
  <div class="wrapper">
    
    <LoginPage @pageShow="pageShow" v-if="isLoginShow"/>
    

    <home v-if="!isLoginShow" />
  </div>
</template>

<script>
import LoginPage from "@/pages/loginpage/loginpage";
import home from "@/pages/homepages/home";
const storage = weex.requireModule("storage");
export default {
  name: "App",
  components: {
    LoginPage,
    home
  },
  data() {
    return {
      isLoginShow: true,
    };
  },
  methods: {
    initIconFont() {
      let domModule = weex.requireModule("dom");
      domModule.addRule("fontFace", {
        fontFamily: "iconfont",
        src: "url('http://at.alicdn.com/t/font_1628280_ezjye9qfie8.ttf')",
      });
    },
    //判断是否登陆过
    isLogin() {
      storage.getItem("token", (e) => {
        if (e.result === "success") {
          //console.log(e.data);
          this.isLoginShow = false;
        } else {
          //console.log("1111");
          this.isLoginShow = true;
        }
      });
      console.log();
    },
    pageShow(e){
      this.isLoginShow = e;
    }
  },
  created() {
    this.initIconFont();
    this.isLogin();
  },
};
</script>

<style scoped>
</style>
